<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/common/include.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
 
<html>
	<head>
	<meta http-equiv="content-Type" content="text/html; charset=utf-8" />
		<title>tueye添加专题-tueye广告管理-tueye专业的图片欣赏交流社区</title>
		
		<script type="text/javascript" src="<%=request.getContextPath() %>/script/jquery.js"></script>
	</head>

	<body>
		<form method="post">
		<input name="id" id="id" type="hidden" value="${article.id}" />
	
		
			<table>
				<tr>
					<td>
						<label for="projects">
							    &nbsp;&nbsp;&nbsp;&nbsp;专题名称：
						</label>
						<input name="articleTpTitle" id="articleTpTitle" type="text" value="${article.articleTpTitle}" size=24 />
					</td>
				</tr>
				<tr>
					<td>
						<label for="projects">
							&nbsp;&nbsp;&nbsp;&nbsp;专题简介：
						</label>
						<input name="articleTpicInstr" id="articleTpicInstr" type="text" value="${article.articleTpicInstr}" size=24 />
					</td>
				</tr>
								<tr>
					<td>
						<label for="projects">
							专题页地址：
						</label>
						<input name="articleTpUrl" id="articleTpUrl" type="text" value="${article.articleTpUrl}" size=24 />
					</td>
				</tr>
				
								<tr>
					<td>
						<label for="projects">
							&nbsp;&nbsp;&nbsp;&nbsp;专题选择：
						</label>
							<select name="topicType" id="topicType">
						<c:forEach var="list" items="${list}"> 
                       <option value="${list.id}" <c:if test="${list.type_name eq article.topicType.type_name }" > selected="selected" </c:if> >${list.type_name}</option>
                     </c:forEach>
					 </select>
					</td>
				</tr>
				
				<tr>
					<td align="center">
						<input type="button" value="保存" onclick="savePageName()" />
						&nbsp;&nbsp;
					</td>
				</tr>


			</table>
		</form>
		<script>
// 验证,然后 保存界面
function savePageName()
{
 
var articleTpTitle=$("#articleTpTitle").val();
 
var articleTpicInstr=$("#articleTpicInstr").val();

var articleTpUrl=$("#articleTpUrl").val();

var topicType=$("#topicType").val();



if(articleTpTitle==""||articleTpTitle==null ) 
{
alert("专题名称不能为空!")
$("#articleTpTitle").focus();
  return;
}

if(articleTpicInstr==""||articleTpicInstr==null ) 
{
alert("专题简介不能为空!")
$("#articleTpicInstr").focus();
  return;
}

if(articleTpUrl==""||articleTpUrl==null ) 
{
alert("广告位置描述不能为空!")
$("#articleTpUrl").focus();
  return;
} 

var id = $('#id').val();
var type = $('#type').val();
var sendData="articleTpTitle="+ encodeURIComponent(articleTpTitle)+"&articleTpicInstr="+encodeURIComponent(articleTpicInstr)
+"&id="+id+"&articleTpUrl="+encodeURIComponent(articleTpUrl)+"&topicType="+encodeURIComponent(topicType); 

    		$.ajax({ 
			url: "<%=request.getContextPath()%>/article.do?action=save" ,
			type:'post', //数据发送方式 
			dataType:'action', //接受数据格式 
			data: sendData , 
			// beforeSend: function() {$("<img src='../images/wait18.gif' />").appendTo("#DivTblContact")},  
			success:update_page //回传函数(这里是函数名)   error转向错误页面
            }); 
            
}
    function update_page(obj) { //ajax保存成功后,触发 id为rain 的onclick事件
          window.location.reload();
     } 		 




function getKeyWord(){
	var theUrl = "<%=request.getContextPath()%>/pages/admin/sysdic/sysdicvalueList.jsp";
	var width = 500;
	var heigh = 400;
	window.open(theUrl,'','menubar=no, z-look=yes, scrollbars=yes, toolbar=no, status=yes, resizable=no, width='+ width +', height='+heigh);

}

</script>
	</body>
</html>
